﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;

namespace Acme.BookStore2
{

    [Dependency(ReplaceServices = true)]
    [ExposeServices(
        typeof(IIdentityRoleAppService),
        typeof(IdentityRoleAppService),
        typeof(IExtendIdentityRoleAppService),
        typeof(ExtendIdentityRoleAppService))]
    public class ExtendIdentityRoleAppService : IdentityRoleAppService, IExtendIdentityRoleAppService
    {
        private readonly  IdenityClaimTypeManager IdenityClaimTypeManager;
        private readonly IIdentityClaimTypeRepository identityClaimTypeRepository;

        public ExtendIdentityRoleAppService(
            IdentityRoleManager roleManager, 
            IIdentityRoleRepository roleRepository, 
            IIdentityClaimTypeRepository identityClaimTypeRepository,
            IdenityClaimTypeManager IdenityClaimTypeManager) : base(roleManager, roleRepository)
        {
            this.identityClaimTypeRepository = identityClaimTypeRepository;
            this.IdenityClaimTypeManager = IdenityClaimTypeManager;
        }


        public async Task<ListResultDto<IdentityClaimTypeDto>> GetIdentityClaimTypesAsync()
        {
            var list = await identityClaimTypeRepository.GetListAsync();
            return new ListResultDto<IdentityClaimTypeDto>(ObjectMapper.Map<List<IdentityClaimType>, List<IdentityClaimTypeDto>>(list));
        }

        //public async Task<ListResultDto<IdentityRoleClaim>> GetIdentityRoleClaims(Guid roleId)
        //{
        //    IdentityRoleClaim
        //    //RoleRepository.
        //}

    }
}
